package com.itheima.adminlte.system.controller;

import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.GetMapping;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

import java.util.HashMap;
import java.util.Map;

@Controller
@RequestMapping
public class PageController {
    @ResponseBody
    @GetMapping("/hello")
    public Map<String, String> hello() {
        System.out.println("hello");
        Map<String, String> map = new HashMap<>();
        map.put("message", "hello");
        return map;
    }

    @GetMapping({"/", "/index.html"})
    public String index() {
        System.out.println("index");
        return "all-admin-index";
    }

    @GetMapping("/{page}.html")
    public String page(@PathVariable("page") String page) {
        System.out.println(page);
        return page;
    }
}
